How to ensure images all loaded before I reference in my HTML canvas [closed]
Posted
by
mark stephens
on Pro Webmasters
See other posts from Pro Webmasters
or by mark stephens
Published on 2011-02-16T20:51:40Z
Indexed on
2011/02/16
23:35 UTC
Read the original article
Hit count: 436
I want to draw some images in on a HTML canvas with
context.drawImage(Im1 ,205,18,184,38);
In order to make sure it loads I need to put in code like this but then I cannot draw things with it
var Im1 = new Image(); Im1.src="rechnung11014page1/img/1/Im1.png"; Im1.onload = function() { context.drawImage(Im1 ,205,18,184,38); }
Is there a way to load all the images and then execute a block of code using several images?
© Pro Webmasters or respective owner